Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
Name | for() |
||||||||
---|---|---|---|---|---|---|---|---|---|
Examples | // set pins 8-15 to HIGH for (int i=8; i<16; i=i+1) { digitalWrite(i, HIGH); } |
||||||||
Description | Controls a sequence of repetitions. A for() structure has three parts: init, test, and update. Each part must be separated by a semi-colon ";". The loop continues until the test evaluates to false. When a for() structure is executed, the following sequence of events occurs: 1. The init statement is executed 2. The test is evaluated to be true or false 3. If the test is true, jump to step 4. If the test is False, jump to step 6 4. Execute the statements within the block 5. Execute the update statement and jump to step 2 6. Exit the loop. |
||||||||
Syntax | for (init; test; update) {
statements
}
|
||||||||
Parameters |
|
||||||||
Usage | Application | ||||||||
Related | while() |